### -*- coding: utf-8 -*- #############################################
# Разработано компанией Ключевые Решения (http://keysolutions.ru/)
# Все права защищены, 2006-2007
#
# Developed by Key Solutions (http://keysolutions.ru/)
# All right reserved, 2006-2007
#######################################################################
"""GeneticView class for the Zope 3 based diplom package

$Id: geneticview.py 65 2007-12-28 20:27:50Z Arvi3D $
"""
__author__  = "Arvid"
__license__ = "ZPL"
__version__ = "$Revision: 65 $"
__date__ = "$Date: 2007-12-28 20:27:50 +0000 (Fri, 28 Dec 2007) $"

from zope.interface import Interface
from zope.app.i18n import ZopeMessageFactory as _
from zope.formlib.form import EditForm, applyChanges, Fields, Field, haveInputWidgets, action
from zope.app import zapi

from diplom.interfaces import IGenetic

class GeneticView(EditForm) :

    label= _(u"Find parameters by genetic algorithm")
    form_fields = Fields(IGenetic)

    @action(_("Find"), condition=haveInputWidgets)
    def handle_edit_action(self, action, data):
        EditForm.handle_edit_action.success_handler(self, action, data)
        IGenetic(self.context).runAlgorithm(self.context)
